<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('Purchase list')" />
</head>
<body class="gray-bg">
     <div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="formId">
					<div class="select-list">
						<ul>
							<li>
								art_no：<input type="text" name="artNo"/>
							</li>

							<li>
								sku：<input type="text" name="sku"/>
							</li>

							<li>
								Supplier Name：<input type="text" name="supplierName"/>
							</li>

							<li>
								Amount：<input type="text" name="amount"/>
							</li>

							<li>
								Purchase Value：<input type="text" name="purchaseValue"/>
							</li>

							<li>
								Freight：<input type="text" name="freight"/>
							</li>

							<li>
								Tax：<input type="text" name="tax"/>
							</li>

							<li>
								Total Value：<input type="text" name="totalValue"/>
							</li>

							<li>
								Unit Price：<input type="text" name="unitPrice"/>
							</li>

							<li>
								Order Date：<input type="text" name="orderDate"/>
							</li>

							<li>
								Arrive Date：<input type="text" name="arriveDate"/>
							</li>

							<li>
								Exp Date：<input type="text" name="expDate"/>
							</li>

							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;search</a>
								<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;reset</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
			
	        <div class="btn-group-sm" id="toolbar" role="group">
				<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:purchase:add">
					<i class="fa fa-plus"></i> add
				</a>
				<a class="btn btn-primary btn-edit disabled" onclick="$.operate.edit()" shiro:hasPermission="system:purchase:edit">
					<i class="fa fa-edit"></i> edit
				</a>
				<a class="btn btn-danger btn-del btn-del disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:purchase:remove">
					<i class="fa fa-remove"></i> remove
				</a>
				<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:purchase:export">
						<i class="fa fa-download"></i> export
				 </a>
			</div>
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table" data-mobile-responsive="true"></table>
			</div>
		</div>
	</div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('system:purchase:edit')}]];
        var removeFlag = [[${@permission.hasPermi('system:purchase:remove')}]];
        var prefix = ctx + "system/purchase";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
				exportUrl: prefix + "/export",
                modalName: "Purchase",
		        showExport: true,
                columns: [{
		            checkbox: true
		        },
				{
					field : 'purchaseId', 
					title : 'purchase id',
					visible: false
				},
				{
					field : 'artNo', 
					title : 'art_no',
					sortable: true
				},
				{
					field : 'sku', 
					title : 'sku',
					sortable: true
				},
				{
					field : 'supplierName', 
					title : 'Supplier Name',
					sortable: true
				},
				{
					field : 'amount', 
					title : 'Amount',
					sortable: true
				},
				{
					field : 'purchaseValue', 
					title : 'Purchase Value',
					sortable: true
				},
				{
					field : 'freight', 
					title : 'Freight',
					sortable: true
				},
				{
					field : 'tax', 
					title : 'Tax',
					sortable: true
				},
				{
					field : 'totalValue', 
					title : 'Total Value',
					sortable: true
				},
				{
					field : 'unitPrice', 
					title : 'Unit Price',
					sortable: true
				},
				{
					field : 'orderDate', 
					title : 'Order Date',
					sortable: true
				},
				{
					field : 'arriveDate', 
					title : 'Arrive Date',
					sortable: true
				},
				{
					field : 'expDate', 
					title : 'Exp Date',
					sortable: true
				},
		        {
		            title: 'operate',
		            align: 'center',
		            formatter: function(value, row, index) {
		            	var actions = [];
		            	actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.purchaseId + '\')"><i class="fa fa-edit"></i>edit</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.purchaseId + '\')"><i class="fa fa-remove"></i>delete</a>');
						return actions.join('');
		            }
		        }]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>